//
//  Sun.h
//  test
//
//  Created by sunshine on 16/10/8.
//  Copyright © 2016年 sun. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UIButtonSun.h"
#import "UIViewSun.h"
#import "UIViewControllerSun.h"


#define SCREENWIDTH [UIScreen mainScreen].bounds.size.width
#define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height
#define FONT(x) [UIFont systemFontOfSize:x]
#define X(x) (SCREENWIDTH / 375.0 * x)
#define AY(y) ((SCREENHEIGHT - 49 - 64) / (667.0 - 49 - 64) * y)
#define TY(y) ((SCREENHEIGHT - 64) / (667.0 - 64) * y)
#define BY(y) ((SCREENHEIGHT - 49) / (667.0 - 49) * y)
#define NY(y) (SCREENHEIGHT / 667.0 * y)
#define Y(y) TY(y)

typedef enum SunDirection{
    SunDirectionBottom = 0,
    SunDirectionRight,
    SunDirectionDiagonal0,
    SunDirectionDiagonal1
}SunDirection;
typedef void (^CancelBlock)(void);
typedef void (^SureBlock)(void);
@interface Sun : NSObject
@property(nonatomic,strong)CancelBlock cancelBlock;
@property(nonatomic,strong)SureBlock sureBlock;
+ (instancetype)shareSun;
- (void)show:(UIView *)view to:(id)target shouldReturn:(BOOL)shouldReturn;
- (void)showActivity:(UIViewController *)controller;
- (void)alertAlign:(NSTextAlignment)align title:(NSString *)title content:(NSString *)content  left:(NSString *)left right:(NSString *)right cancel:(CancelBlock)cancel sure:(SureBlock)sure To:(UIViewController *)viewController;
- (void)showMsg:(NSString *)msg;
- (void)hideActivity;
- (void)hideShow;
- (void)hideAll;
+ (id)getUser:(NSString *)key;
+ (void)setUser:(id)value forKey:(NSString *)key;
+ (NSString *)timestamp:(NSTimeInterval)timestamp ToTime:(NSString *)type;
+ (UIImage *)imageWithColor:(UIColor *)color;
+ (UIImage *)imageWithColorFrom:(UIColor *)startColor To:(UIColor *)endColor Frame:(CGRect)frame Direction:(SunDirection)direction;
+ (void)drawDashLine:(UIView *)lineView lineLength:(int)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor;
+ (NSString *)formatStringToMoney:(NSString *)money;
+ (NSString *)formatStringToPhone:(NSString *)string;
+ (NSString *)formatStringToBank:(NSString *)bankNum;
+ (NSString *)hidePhone:(NSString *)string;
+ (BOOL)checkPhone:(NSString *)phone;
+ (id)copyWithView:(UIView *)view;
+ (NSString *)htmlFormat:(NSString *)str;
+ (void)labelSetLineHeight:(float)height To:(UILabel *)label;
+ (NSDictionary *)dictionaryFromUrlString:(NSString *)urlStr;
+ (NSString *)stringFromDictionary:(NSDictionary *)dic;
@end
